home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / pgp20src.zip / SPARC.S < prev    next >
Text File  |  1992-03-05  |  1KB  |  81 lines

  1. !
  2. ! SPARC assembler primitives for rsalib.c
  3. ! written by Branko Lankester, lankeste@fwi.uva.nl    8/29/91
  4. !
  5. ! other sources must be compiled with UNIT32 and HIGHFIRST defined
  6. !
  7.     .seg    "text"
  8.         .proc   4
  9.         .global _P_SETP
  10. _P_SETP:
  11.     retl
  12.     nop
  13.  
  14.  
  15.         .proc   4
  16.         .global _P_ADDC
  17. _P_ADDC:
  18.     sethi    %hi(_global_precision), %o3
  19.     ldsh    [%o3+%lo(_global_precision)], %o3
  20.     and    %o2, 1, %o2
  21.     dec    %o3
  22.     sll    %o3, 2, %o3
  23.     ld    [%o0+%o3], %o4
  24. add_loop:
  25.     ld    [%o1+%o3], %o5
  26.     subcc    %g0, %o2, %g0
  27.     addxcc    %o4, %o5, %o4
  28.     addx    %g0, %g0, %o2
  29.     st    %o4, [%o0+%o3]
  30.     subcc    %o3, 4, %o3
  31.     bge,a    add_loop
  32.     ld    [%o0+%o3], %o4
  33.     retl
  34.     mov    %o2, %o0        ! return carry
  35.  
  36.  
  37.         .proc   4
  38.         .global _P_SUBB
  39. _P_SUBB:
  40.     sethi    %hi(_global_precision), %o3
  41.     ldsh    [%o3+%lo(_global_precision)], %o3
  42.     and    %o2, 1, %o2
  43.     dec    %o3
  44.     sll    %o3, 2, %o3
  45.     ld    [%o0+%o3], %o4
  46. sub_loop:
  47.     ld    [%o1+%o3], %o5
  48.     subcc    %g0, %o2, %g0
  49.     subxcc    %o4, %o5, %o4
  50.     addx    %g0, %g0, %o2
  51.     st    %o4, [%o0+%o3]
  52.     subcc    %o3, 4, %o3
  53.     bge,a    sub_loop
  54.     ld    [%o0+%o3], %o4
  55.     retl
  56.     mov    %o2, %o0
  57.  
  58.  
  59.         .proc   4
  60.         .global _P_ROTL
  61. _P_ROTL:
  62.     sethi    %hi(_global_precision), %o3
  63.     ldsh    [%o3+%lo(_global_precision)], %o3
  64.     and    %o1, 1, %o1
  65.     dec    %o3
  66.     sll    %o3, 2, %o3
  67.     ld    [%o0+%o3], %o4
  68. rot_loop:
  69.     sll    %o4, 1, %o5
  70.     or    %o5, %o1, %o5
  71.     st    %o5, [%o0+%o3]
  72.     srl    %o4, 31, %o1
  73.     subcc    %o3, 4, %o3
  74.     bge,a    rot_loop
  75.     ld    [%o0+%o3], %o4
  76.     retl
  77.     mov    %o1, %o0
  78.  
  79.     .seg    "data"
  80.  
  81.